Copyright (c) 1999 Massachusetts Institute of Technology

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or (at
your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, see https://gnu.org/licenses or write
to:
  Free Software Foundation, Inc.
  51 Franklin Street, Fifth Floor
  Boston, MA 02110-1301
  USA
------------------------------

Character Mode for the XGP

The PDP-11 program for the XGP interprets character strings in files
in the following format:


Byte	Usual meaning			Escape significance

0	Null - byte is ignored		Normal
1	Normal				XGP ESCAPE 1
2	Normal				XGP ESCAPE 2
3	Normal				XGP ESCAPE 3
4	Normal				XGP ESCAPE 4
5-7	Normal				Reserved
10	Backspace			Normal
11	TAB				Normal
12	LF				Normal
13	Normal				Reserved
14	FF				Normal
15	CR				Normal
16-37	Normal				Reserved
40-176	Normal				Normal
177	ESCAPE				Normal

Normal means the definition of this byte in  the current font will be
printed.  If this byte is  undefined in the current  font, it will be
ignored.

ESCAPE causes the next  byte to  have an  alternate meaning  selected
from the column "Escape significance".

Backspace  spaces to  the left the  width  of
one   space in the current font, including inter-character
spacing.

TAB produces  a column  select to  the column which  is at  least the
width  of a blank  to the right  of the current  column position, and
some multiple of 8 blank widths to the right of the left margin.
(this computation of the width includes the inter character spacing)

LF activates the current  text line. The current text  will be queued
to printed. This line will be printed at a vertical location such
that the distance between the baselines of of it and the preceeding line
is equal to the vertical spacing parameter, unless this would cause
the subscripts of the former line to overlap vertically with the superscripts
of this line.  It will then be pushed down to make this not the case.

FF, like  LF, activates  the text.   In  addition, FF  causes a  page
eject  after the  current text  line is  printed.   FF also  sets the
defalut Y position to the first line below the top of page  margin on
the new page.

The program will automatically form feed when the next text line would
place characters below the bottom margin.  Sequential form feeds will
increment the page number but will otherwise be ignored.

CR  causes  a  column  select  to  the  current  left  margin  to  be
generated.  This can be used to produce overprinting.


XGP ESCAPE  1 ('177&'001) causes  the next  7 bits  to be  read as  a
special operation code.  The following codes are implemented:

	0-3	Font select.
		The code, 0 to 3 is taken as the font identification
		number of the font to use.

	4-37	Reserved for future use.

	40	XGP Column Selector
		The  next  14  bits  are taken  as  the
		x-position to print  at next.  (The  intention  is to
		allow arbitrary width spaces for text justification.)

	41	XGP Underscore
		The next  7 bits are taken as the scan-line number on
		which to underscore.  It is taken as a 2's complement
		increment to the base line.  Zero is on the baseline,
		positive bytes are down from it.  Underscores outside
		the range of the other characters on the line will be
		ignored.   The  next 14 bits are taken as the length
		of the underscore.

	42	Line space.
		This does  a line feed and then takes the byte as the
		number of lines between this line's baseline and the
		baeline of the following line.

	43	Base-line adjust.
		The next  7 bits are taken in two's complement as the
		base-line adjustment  to  the  current  font.     The
		adjustment sticks  until  reset  by  another   adjust
		command or a font select. The intention is to allow a
		font to be  used  for  subscripts  and  superscripts.
		(Increment baseline  for  superscript,  decrement for
		subscript).  

**	44	Print the paper page number.
		The paper page number is set to 1 by a form feed.  It
		is  incremented  each  time  the  paper  is cut.  The
		decimal value of this count is printed.

**	45	Accept heading text.
		The next  byte  is a  count of bytes to follow. Those
		bytes  will be read into the heading line.  When that
		count is exhausted, the heading line will be printed.
		If a line feed or line space command  is  given  that
		would cause text to be printed below the current text
		area,  a  form  feed  is inserted by the XGP and if a 
		heading is defined, it will be printed.

	46	Start Underline.
		Set the left end of an underline. See Stop Underline.

	47	Stop Underline.
		The  next byte is the scan line on which to write the
		underline (same as XGP Underscore).   The  extent  of
		the underscore is defined by this command  and  Start
		Underline. If this command is not preceded by a Start
		Underline, it will underline from the left margin.
		Beware	of column selects.  No  underline  will  happen
		until this command is given.

	50	Takes the next byte as the intercharacter spacing
		This is reset to zero at the end of each line.

XGP ESCAPE 2  ('177&'002) causes the next 7  bits to be taken  as the
column  increment.    This  quantity  is  signed: 0-77  are  positive
increments 100 to 177 are negative increments (100  -100, 177  -1).

XGP ESCAPE 3 ('177&'003) causes  the next 2 bytes to be  taken as the
scan line  number on which to  start this text line.   Scan line 0 is
the first  scan line  on the  page (immediately  following the  cut).
The topmost scanline  of the present text line will  be placed on the
scan  line indicated in this  command.  


**  XGP ESCAPE 4 ('177&'004).   This escape is used to  specify a vector.
It is followed by 11 bytes describing the vector:

	2 bytes	Y0	Scan line number of first line of vector.
	2 bytes X0	Column  position of left  edge of first  line
			of the vector.
	3 bytes DX	Delta X. 1 bit of sign; 11  bits  of integer;
			9 bits of fraction.
	2 bytes N	The number of scan lines on which this vector
			is visible.
	2 bytes W	The column width of each scan-line.

The  XGP   service  must   be  presented   with  vectors  sorted   by
ascendending  values  of Y0.   If  the  vectors are  not  sorted, the
output will be wrong.

The escape significance  of codes 5 through  10,  13, and  16 through
37 is not defined at the present time but reserved for future use.

$
